Repository navigation
Workbench: see and test every OpenBot Desktop and app screen in any state - #2030
Draft
dustywusty wants to merge 60 commits into
Draft
dustywusty wants to merge 60 commits into
dustywusty wants to merge 60 commits into
Conversation
…bench share Every command and event the desktop window uses, in one registry that a test keeps in step with the window. A control object answers each command (a value, never, a problem, a delay or a script), sends events, and logs every call. The setup layout test's per-state answers are ported here as typed code.
A Vite config that serves the real window on port 3021 against the fake native side, a page clock, the window frame with a 4px grid and an inspector, layout checks, the theme switch for the frame, and the run, command, event, call and warning panels. A test makes sure that none of it reaches the shipped build.
The test's own scripted native side (FAKE_CORE, FAKE_EVENT) moves to src/fakeNative, so the test and the workbench use one fake and cannot drift. No assertion changed: 88 pass, 697 expect() calls, as before.
…te in the link The workbench page shows the real setup window in a Mac or Windows frame at any size, theme and zoom, with a 4px grid and an inspector. Every state the layout test knows is a scene. The link holds the scene, the window settings and the answers. The frame runs on a page clock.
Hand-written runs of a real install, typed against the window's own types: a Mac, Windows, a slow download, a step that fails, a slow sign-in, a relaunch with an update, and a Claude plan sign-in. A run step can emit an event, set or settle an answer, click, or type. Seeking stops at each run step, so a link gives the same frame every time, and a run stops at its end with a note that the real window hands over to OpenBot there.
Press C or Comment, click an element or drag a box around an area, say what you want, and Copy as prompt. The prompt names the element, its React components and the source line it is drawn at (through the served module's source map), its box, gaps, grid offset and styles, the scene, time and window, and the command that shoots the same frame. An area gets its elements and a spacing summary.
…rnings The right panel sets any command's answer (kept in the link), lists every native call and sends any event. Under the window, layout warnings list each element that moved more than 2 px, was cut off or left the window, with the time and the cause; a click seeks to it. The fake records how each call ended, so the handover note shows only when show_openbot succeeded.
…g logs workbench:check plays every scene to its end and fails when a run step cannot find its button or field, or a run stalls. CI runs it and the workbench browser tests in the desktop browser job. workbench:import turns a customer's troubleshooting file into a scene: its [step] rows at their real times, and what failed on the last row. Imported scenes stay in a gitignored folder.
…tting down windows Six timed runs beside the install runs: Status stop and start, Status while an update runs, a relaunch where the person starts the update, the move to OpenBot Cloud and a move that fails and is tried again, and Shutting down to its end. Payloads use the native side's own wording.
…action, and Import a log Runs play at ¼× and ½× as well. Each click and type a run makes shows a marker on its target, and Pause at each action stops before it with the target outlined. An imported troubleshooting log appears in the scene list, and a file can be imported in the page. Groups of elements that move together show as one warning. The fake's move failure uses the native side's sentence.
Imported troubleshooting logs are local and approximate, so workbench:check skips them unless --include-imported is given. The screenshot CLI loads them from disk.
… done Each user of ensureServer takes a lease; the server stops when no live lease remains, and never when a person started it by hand. A start lock keeps two users from starting two servers. WORKBENCH_PORT gives a separate port when isolation is needed.
A row that stays on screen while the step changes (the background install row moving 157 px and 222 px on a first run) is a real layout bug, so a new heading no longer hides moves. Elements that move together still show as one warning for the whole page.
The contract the desktop and app halves share, the Desktop page commands the app calls (checked against the Rust side), the Desktop page scripts read from the Rust source, the click and type helpers in a file with no imports, which scene follows a handover or a handback, and a scene list, window frame and settings panel that take app scenes.
An in-page fetch answers the app's /api calls from the scene's answers, hand-written handlers and the generated MSW handlers. The CopilotKit agent stream and the app's sockets are fakes that run steps can write to. The app's Desktop bridge runs on the shared native fake. The app gets its own workbench Vite config, a preboot for storage, theme and motion, and the Desktop page scripts read from Rust. The link holds API answers and app settings, a scene catalog joins both halves, and new panels list requests, set API answers and send stream and socket events.
…r behind the proxy The signed-in person and organization are API answers a scene can change. Desktop page commands have defaults typed by the app's own types. Every generated MSW handler file feeds the fake API, and hand-written handlers answer the calls outside the spec. App runs drive the frame on the page clock with a seeded random. The workbench server starts the app's server on 3023 and serves it same-origin under /__app, and stops it with itself. The fake fetch passes non-API requests through untouched.
The page loads the scene catalog (desktop scenes and app scenes from the app server) and shows app scenes in a browser or desktop host. The app frame boots the page clock, the fake API, agent stream, sockets and the Desktop bridge before the real app runs, with the Desktop page scripts the native side would add. The first app scene is Home with Bots.
The frame said it had booted before the app's modules loaded, so the page seeked and showed a blank window while the app waited on a paused clock. A boot module after main.tsx now marks the frame ready when the root gets its first child. A browser test opens Home with Bots in the workbench and expects its text.
For an app scene the page shows the Desktop commands, the requests the app made, the API answers a person can set, and the stream and socket events to send. Layout warnings also check after requests and stream or socket events. The CLI shoots app scenes and its check fails on a request with no answer or an error in the app. Comment prompts name the route and host. Browser tests pin the app frame and its determinism; a guard keeps the workbench out of the shipped app. The whole window shows above the warnings.
The frame was ready only once the app drew, but the page keeps the clock paused until the frame is ready, so a first screen behind a delayed answer or a retry never drew. After a quiet stretch of real time with nothing drawn, the frame now says it booted and the page walks the clock.
… handover cards App scenes for Home with and without Bots, an update offered, a conversation in the middle of a run with tool calls, onboarding, signed out and the connection lost. At the end of a setup run the page offers to open the app scene that follows; an app that hands back to setup offers the setup scene it goes to.
The AI model row as set, changed to an API key, and refused by the provider; Share usage data on, turned off, and turned off on this computer. Runs can click switches, menu items, options and checkboxes.
The signed-in session also answers no plan required, no company sign-in and no personal AI, so the generated mocks' made-up trial bar and sections no longer push every screen down 40 px. A request waiting on a set answer names that answer, so nothing calls it missing while it waits.
Route chunks and fetches finish on real time, so a seek could move the clock before the app drew and shift timers it started (a connection check at 8.0 s on one path and 8.5 s on another). Each seek stop now waits until no request or route load is in flight and the page stops changing for two frames, with a 3 s cap. Request times are the same on every seek path.
…user bun run workbench --port <n> or WORKBENCH_PORT picks the page's port, and WORKBENCH_APP_PORT the app server's; a busy port fails with one line. The shared server dropped mid-run for two reasons: Vite restarted it whenever its config or an import changed, and it ran in its starter's process group, so stopping the starter stopped it for everyone. It now keeps its config until restarted by hand and runs in its own group.
…arnings Motion draws a value change only when its time has moved on, and its time is the page clock. With the clock standing still, every change after the first at that time stayed undrawn, so headings and rows entered at opacity 0 and stayed there. Motion's time now moves forward a millionth of a millisecond per task while the clock stands still. Screen-reader-only labels are no longer flagged as cut off or moved.
The lavender-gray ground with its blur circles, glass panels, Plus Jakarta Sans and Spline Sans Mono, and the token spacing and radii, with a dark variant built from the same tokens. Only the page around the window changes; the window and its contents are drawn as the app draws them.
The desktop browser job writes the app config, runs the app frame, determinism and CLI browser tests, walks the app scenes in workbench:check, and builds the app with the workbench guard on.
Settings, This computer in the Desktop window (an update found and a worker's memory changing) and in a browser, and Move to OpenBot Cloud from Settings, which hands back to the setup window.
Warnings keep the element's box before and after. Hovering a warning seeks to its time and draws where the element was, where it went and an arrow labelled with the distance; a cut-off shows the hidden part and an outside warning the part past the window. A click keeps the mark. Scene rows are one line.
…ents For a scene at a time, or every scene with --all, it saves the frame, its elements and warnings, and a prompt that starts /impeccable critique (or audit, layout, typeset, clarify, polish) on the screen's main source file. The prompt tells the agent to re-render with workbench:shot, because a plain page has none of the scene's state.
…, and plain fonts Comment prompts for app scenes carry the route the app shows now and the host. The browser bar follows the app's own navigation. The handback card has real buttons, scene titles show in full on hover, and the page drops the web fonts and the tinted ground.
…mode The page uses the system sans-serif on a flat ground, with clearer controls, a selected scene you can see, a labelled Window panel, one-line requests and readable helper text, from an impeccable critique. Scenes can be filtered and folded by group, panels resized, and the page driven by keys. Fit zoom shows the whole window. bun run workbench lands on the workbench. Comment mode can ask for an impeccable critique, audit, layout, typeset, clarify or polish of the picked part, and Critique this screen asks for the whole frame.
Bun 1.3.14 closes a closed Chromium's pipe file descriptors again when it collects garbage, so the next Chromium in the same process lost its DevTools pipe, exited, and Playwright waited until every later file timed out. The browser tests now share one Chromium per process that is never closed, with explicit hook time limits, a Vite cache folder per port, NODE_ENV=development so Vite's dependency hash matches, and the generated app config no longer watched. A frame that reloads while the page waits on it no longer hangs the wait.
…their target CI builds the app with the workbench guard before the Docker steps leave root-owned files. Stopping and reusing the shared server happen under one lock, and stopping it stops the app server it started. The critique browser test runs in CI. Action markers follow their target or go away at every speed, the paused Next marker follows zoom and panel changes, a jump back to a warning keeps the last frame on screen instead of replaying the run in view, and the warnings list keeps its rows under the pointer.
…n check, and visible clicks The Cloud sign-in one-line check measured while the window's entrance animation still had a 1e-5 px translate left, so a 22 px line read as 22.000015 px and failed about 2 runs in 5 (on main too). It now waits for the animation to end. A click or type marker whose target leaves keeps a 500 ms ghost where it was, so the cause of each change is seen. During a jump back the cover keeps the theme, title bar and cards of the last frame. CLIs release their lease on a reused server, an app server that is still starting is stopped too, and the CI Docker steps run with --init.
…stay readable While the pointer is in the warnings list, a jump keeps the rows it shows and mutes the ones the run does not have; the new set shows when the pointer leaves. A click or type ghost holds full strength for most of its half second and fades in the last 150 ms, with a quiet outlined label that sits inside its box when it fits, so it does not hide the new screen's text.
…o restart The page merged the kept warning rows at its own time, which still held the old window's time for one render after a seek back while the new window had no warnings yet, so the list went empty. It now merges at the time of the window's last check, and the watch starts again when the frame reloads. An edit to the workbench Vite config now prints the notice to restart by hand.
…d a settled shot before the jump back - A DOM test whose msw server listened while happy-dom was registered left msw's responses built on that file's happy-dom Response, so later files read empty bodies (app/workbench/api on CI shard 3). The preload puts them back on the platform's Response before each test; msw-realm.test.ts covers it. - The workbench's fake native states use plain scene titles, and its copy of the native Podman pause offer is allowed where that word is. - The motion test takes the window's shot once it settled instead of after a fixed 300 ms, and logs where a frame changed.
The one conflict was setupLayout.browser.test.ts: this branch moved the fake native side out of the test into desktop/src/fakeNative/states.ts, and main changed it in the test (#2029, #2032). Main's changes are in states.ts now: the 20.2 GB footprint, the move result's removedBytes and diskGainedBytes, the #move-done-held and #move-first states (both in STATE_NAMES, so both are workbench scenes), #move-first's held update and __fake.finishUpdate. The workbench's Moved result has the new shape too. Main's new tests stay as main wrote them.
setupLayout.browser.test.ts conflicted again on the fake native side, which this branch keeps in desktop/src/fakeNative/states.ts. Main's #move-done-ai (connectAi on the move result) is in states.ts and STATE_NAMES now, and main's new assertions stay in the test. The app's new sign-in redirect commands are listed as not yet in Desktop's desktop_page.rs, so the registry check still holds both ways.
Main's #2036 registers the sign-in redirect commands in desktop_page.rs, so they move into PAGE_COMMANDS. The app frame's fake has no default for them yet: refused, the app falls back to a paste or a code.
…red within a pixel, and room for --all --check - install-anthropic-plan follows main's #2036: once the address is open the window waits for the browser, and finish_claude_sign_in answers with nothing typed or pressed. The determinism test now checks the wait and that the run goes on to Finishing setup; runner.test.ts keeps the type step covered. - The motion test compares the still with the window within a pixel. CI's renderer drew the still's text a little differently (2.2% of pixels, spread over the whole window) while a replay showing through still measures 6% to 99%; the bound stays 2%. - --all --check took 299 s on CI against its 300 s limit; it has 900 s now.
…at differs Compared within a pixel, CI's still still differs from its window by 2.1%, inside the card and only where motion is allowed, so it is not anti-aliasing. A replay showing through measures 6.4% to 99.7%, so the bound is 5%. A frame past 2% logs both shots, cut to where they differ, to find the cause.
The test wanted every row back after a seek to 0:10, and failed on CI with 9 of 10: a 0:00 move from the window's first layout that the replay did not find again, which the list drops by design. It now checks that every row from 0:10 on stays, muted until the replay finds it, and that found rows are not muted. A merge that empties the list still fails it. The still's 2% on CI, from the logged shots: its text is drawn with other anti-aliasing than the window's composited card, and its progress fill is further on. Nothing of the replay shows.
workbench:check now also writes findings.json: every layout warning and run problem of every committed scene, with the element's component chain and source file, merged into findings (findings.ts). Each move gets a class: shift under hand and jitter are bugs; moves after an input, on a new screen, while a screen loads or a late load shift are expected. The workbench server serves the newest findings.json and runs the check in the background with progress. /workbench/findings/ lists the findings (expected moves hidden by default) and plays each one in the real workbench page with its warning marked. The workbench takes mark= and embed=1 links. CI keeps findings.json as an artifact.
setupLayout.browser.test.ts: main's #2049 added a "stopped" move to the test's own inline fake. On this branch that fake lives in src/fakeNative/states.ts, so the stopped move (OpenBot Cloud's own reason, kind move-stopped) and its #move-stopped state go there.
…xpected moves Cut off now needs a box with hidden overflow that hides more than 2 px of the element's own text (its line boxes against the clip box). An ellipsis or a line clamp, on the element or on the box that cuts it, is on purpose and does not count; nor does text that overflows with overflow visible, or text in a box that scrolls. Outside the window now leaves out an element that the page's own scroll brings into view (not one fixed to the window). The Layout warnings list under the window classifies moves with the same rules as the findings (classifyMoves, splitWarnings, isExpected in findings.ts). It shows jitter, shift under hand, cut off and outside; the expected moves are behind "Show expected moves (N)". Each move row names its class, and the hover still jumps for every row. workbench:check: cut off 4 -> 0, outside 1 -> 0, jitter 4, expected 235.
Port #2051's move-failed-detail answer into desktop/src/fakeNative/states.ts, with the native Upload wording the fake already uses.
…s scene The workbench drew the Mac lights 12 px in, not where macOS puts them, so it could not see a page jammed against them. titleBar.ts now holds the real box (TRAFFIC_LIGHTS 20,31 in main.rs, tao's inset_traffic_lights, AppKit's 12 px circles 8 px apart, middle 32.5 px down; checked against Dusty's capture at scale 1.0), and WindowFrame draws the lights there, over the page. The new Spacing check (spacing.ts, read from the page by layoutWatch.ts) runs on every check of every scene for a Mac Desktop window: nothing and no panel edge within 8 px of the buttons, the buttons fit and centre in a rail column, and they share the row beside them. It is a new finding class, shown by default on the warnings strip and the Findings page with its rule and why. The app-settings-connections scene (Settings → Connections, personal edition, dark) reproduces Dusty's case: the inset panel under the zoom button, the buttons 11 px right of the 72 px column's middle, and the panel's corner beside them.
…twork address The server told the app frame apart by the Sec-Fetch-Dest: iframe header, but browsers send Sec-Fetch headers only to secure origins. http://localhost is one; http://<LAN address> is not, so over the office network the frame got the desktop window's page and stayed blank. Without the header, an HTML navigation whose Referer is the workbench page or an app page on the same host is now the frame.
…ress
navigator.clipboard exists only in a secure context, and http://<LAN address> is not one, so
Copy link, Copy as prompt and Critique this screen failed for anyone using the shared address.
copyText uses navigator.clipboard where it exists and otherwise copies through a hidden, focused
text area with document.execCommand("copy"). A refused copy of the link now shows a notice.
…at the workbench Vite config
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
A workbench that shows every OpenBot Desktop setup window and every app screen, in any state, in a normal browser tab. You can change the state by hand, play a timed run, see a grid, and get layout warnings. People find install bugs before customers do, and agents get the same tools from a CLI.
Start it:
cd desktop && bun run workbench, then open the link it prints. The README isdesktop/workbench/README.md.How it works
desktop/src, and the app comes fromapp/src. Nothing underdesktop/srcorapp/srcchanges, except thatsetupLayout.browser.test.tsnow uses the shared fake. Two tests make sure that nothing of the workbench gets into a shipped build.api/openapi.yaml. A scene's own answers win, then a few hand-written handlers for calls outside the spec, then the generated handlers. A request with no answer failsworkbench:check. The CopilotKit agent stream and the app's sockets are fakes that run steps can write to.What you can do
bun run workbench:import <file>. Imported logs stay in a gitignored folder.workbench:shot(a PNG and a JSON report),workbench:check(plays every scene and fails on a missing click target, a stalled run or an unanswered request), andworkbench:critique(impeccable design-review folders for one scene or all of them).workbench:checkin the desktop browser job.What the workbench found (not fixed here; separate tickets)
Setup window:
ProviderPicker.test.tsx:340). Decide if it stays.App:
install_updatenever resolves on success. The same banner says "ready to install" and "Downloading…" at once.Existing on main (not from this PR):
setupLayout.browser.test.tsfailed about 2 runs in 5 on main; this PR fixes its cause (see below).Calls made without Dusty (please check)
desktop/on port 3021, and the app has its own on 3023 behind it, same-origin under/__app.--port,WORKBENCH_PORTandWORKBENCH_APP_PORTchange them.machine_size::plandoes for WSL.workbench:checkcovers committed scenes only. Imported customer logs are skipped unless--include-imported..github/hooks/impeccable.jsonin the worktree comes from installing impeccable and is not part of this PR.Root causes found on the way
setupLayout.browser.test.tsfailed about 2 runs in 5, on main too. It measured while the window's entrance animation still had a 1e-5 px translate left, so a 22 px line read as 22.000015 px. The test now waits for the animation to end (10 of 10 runs pass).Tests
CI on the final commit
b4ed5ee6(runs/45077021677): every check passes (20 pass, 0 fail; the rest skip by path). This includes:tests, all 5 shards, with the new unit tests under the root happy-dom preload.app (real browser, desktop setup window): the setup layout test, every workbench and app browser test together,workbench:checkon every committed scene, and the app shipped-build guard.app (real browser, WebKit)andverify. An earlier run failed the WebKit sidebar test, which was flaky on main at that time (main job 137346083661 failed, main's next run passed). It passes here.Also run on the branch: